package com.platform.wechat.service.impl;

import com.platform.wechat.common.JsonBean;
import com.platform.wechat.mapper.DoctorMapper;
import com.platform.wechat.service.DoctorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author YP
 * @company ~~
 * @create 2021-07-31 17:24
 */
@Service
public class DoctorServiceImpl implements DoctorService {

    @Autowired
    private DoctorMapper doctorMapper;

    /**
    * @Description: 根据时间查询医生信息
    * @Param: [time]
    * @return: com.platform.wechat.common.JsonBean
    * @Author: YP
    * @Date: 2021/7/31
    * @Time: 20:11
    */
    @Override
    public JsonBean selectDoctorByWorkingTime(String time) {
        System.err.println(time);
        return new JsonBean(0, "ok", doctorMapper.selectDoctorByWorkingTime(time));
    }

    /**
    * @Description: 根据id查询医生信息
    * @Param: [id]
    * @return: com.platform.wechat.common.JsonBean
    * @Author: YP
    * @Date: 2021/7/31
    * @Time: 17:25
    */
    @Override
    public JsonBean selectDoctorById(Integer id) {
        return new JsonBean(0, "ok", doctorMapper.selectByPrimaryKey(id));
    }

    /**
    * @Description: 根据医生id查询医生医院信息与科室信息
    * @Param: [id]
    * @return: com.platform.wechat.common.JsonBean
    * @Author: YP
    * @Date: 2021/8/2
    * @Time: 10:59
    */
    @Override
    public JsonBean selectDoctorForReg(Integer id) {
        return new JsonBean(0, "ok", doctorMapper.selectDoctorByIdToReg(id));
    }

    /** 
    * @Description: 根据医院Id和科室Id查医生集合
    * @Param: [hospitalId, officesId] 
    * @return: com.platform.wechat.common.JsonBean 
    * @Author: guopeixin
    * @Date: 2021/8/2 22:01
    */
    @Override
    public JsonBean selectDoctorByHosAndOffId(Integer hospitalId, Integer officesId) {
        return new JsonBean(0, "ok", doctorMapper.selectDoctorByHosAndOffId(hospitalId, officesId));
    }

    /**
     * @Description: 根据医院Id和科室Id查医生集合
     * @Param: [hospitalId, officesId]
     * @return: com.platform.wechat.common.JsonBean
     * @Author: guopeixin
     * @Date: 2021/8/2 22:01
     */
    @Override
    public JsonBean selectDoctorByHosAndOffIdAndDoctorId(Integer hospitalId, Integer officesId, Integer doctorId) {
        return new JsonBean(0, "ok", doctorMapper.selectDoctorByHosAndOffIdAndDoctorId(hospitalId, officesId, doctorId));
    }

    /** 
    * @Description: 时间段中有工作安排的医生
    * @Param: [hospitalId, officesId, doctorId] 
    * @return: com.platform.wechat.common.JsonBean 
    * @Author: guopeixin
    * @Date: 2021/8/3 15:13
    */
    @Override
    public JsonBean selectWorkDoctors(Integer hospitalId, Integer officesId, Integer doctorId) {

        return new JsonBean(0, "ok", doctorMapper.selectWorkDoctors(hospitalId, officesId, doctorId));
    }


}
